﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Services;

namespace Himp.TaskScheduling
{
    public class ParamConfigManager : DomainService
    {
        public async Task<Dictionary<string, object>> GetValues(List<string> keys)
        {
            Dictionary<string, object> keyValuePairs = new Dictionary<string, object>();

            foreach (var key in keys)
            {
                var v = await RedisHelper.GetString(key);
                keyValuePairs.Add(key, v);
            }

            return keyValuePairs;
        }

        public async Task<List<string>> GetKeys()
        {
            var keys = RedisHelper.GetKeys();

            return keys;
        }

        public async Task<Dictionary<string, object>> GetValues()
        {
            Dictionary<string, object> keyValuePairs = new Dictionary<string, object>();
            var keys = RedisHelper.GetKeys();

            foreach (var key in keys)
            {
                var v = await RedisHelper.GetObject(key);
                keyValuePairs.Add(key, v);
            }

            return keyValuePairs;
        }
    }
}
